<template>
    <div>
        <p>我是详情页</p>
        <button @click="showmodal">显示模态框</button>
        <!-- 使用子组件 -->
        <Mymodal ref="mymodalcom"></Mymodal>
    </div>
</template>

<script setup lang="ts">
// ref 使用在子组件上的情况
import { ref } from 'vue'
// 导入子组件 Mymodal.vue
import Mymodal from '@/components/Mymodal.vue';

// const mymodalcom = ref<InstanceType<typeof Mymodal> | null>(null)
const mymodalcom = ref()
const showmodal = () => {
    mymodalcom.value.open()
}
console.log('mymodalcom', mymodalcom);

</script>
<style scoped></style>